package com.easy.facilitaterecycleadapter.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.easy.facilitaterecycleadapter.R;
import com.easy.facilitaterecycleadapter.adapter.BaseAdapter;
import com.easy.facilitaterecycleadapter.adapter.BaseViewHodler;
import com.easy.facilitaterecycleadapter.adapter.MultiTypeSupport;

import java.util.List;

/**
 * Created by Sigthp-P-Department on 2018/5/7.
 */

public class TestAdapter extends BaseAdapter<Integer> {
    public OnClickLisener mOnClickLisener;

    public TestAdapter(List<Integer> list, Context context,int layoutId) {
        super(list, context ,layoutId);
    }
    public TestAdapter(List<Integer> list, Context context,MultiTypeSupport multiTypeSupport) {
        super(list, context ,multiTypeSupport);
    }
    @Override
    public void bindData(BaseViewHodler holder, final int position) {
        holder.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if(mOnClickLisener!=null){
                    mOnClickLisener.OnItemClickLisener(position);
                }
            }
        });
        holder.setOnLoogClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                mOnClickLisener.OnLoogClickListener(position);
                return false;
            }
        });
        TextView textView2 = holder.getView(R.id.tv_number);
        textView2.setText(mList.get(position)+"");
    }
    public interface OnClickLisener{
        void OnItemClickLisener(int position);
        void OnLoogClickListener(int position);
    }
    public void setOnClickLisener(OnClickLisener onClickLisener){
        this.mOnClickLisener=onClickLisener;
    }
}
